package com.chagee.store.operation.server.facade;

import com.chagee.base.utils.*;
import com.chagee.store.operation.api.request.*;
import com.chagee.store.operation.server.model.param.WorkOrderDeviceParam;
import com.chagee.store.operation.api.response.StoreWorkOrderDeviceResponse;
import com.chagee.store.operation.api.response.WorkOrderResponse;
import com.chagee.store.operation.server.model.param.*;
import com.chagee.store.operation.server.model.vo.*;
import com.chagee.store.operation.server.service.biz.WorkOrderBizService;
import com.chagee.store.operation.server.service.biz.WorkOrderDeviceBizService;
import com.chagee.storeManagement.api.event.response.BasePageResponse;
import com.chagee.storeManagement.api.event.response.QueryStoreOperateRecordResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.ui.ModelMap;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Slf4j
@Service
@RequiredArgsConstructor
public class WorkOrderFacade {

	@Resource
	private WorkOrderDeviceBizService workOrderDeviceBizService;

	@Resource
	private WorkOrderBizService workOrderBizService;

	/**
	 * 获取工单的交接的设备信息
	 *
	 * @param workOrderDeviceParam 工单编号
	 * @return 交接设备对象
	 */
	public StoreWorkOrderDeviceResponse getWorkOrderDevice(WorkOrderDeviceParam workOrderDeviceParam) {
		return workOrderDeviceBizService.getDeviceList(workOrderDeviceParam.getWorkOrderNumber());
	}

	/**
	 * 开早打样工单详情
	 *
	 * @param request 工单编号
	 * @return 工单信息
	 */
	public WorkOrderResponse queryDetail(WorkOrderDetailRequest request) {
		return workOrderBizService.queryDetail(request);
	}

	public List<String> distinctSupplier() {
		return workOrderBizService.distinctSupplier();
	}

	/**
	 * 工单表查询
	 */
	public PaginationData<WorkOrderResponse> query(PaginationRequest<WorkOrderRequest> request){
		return workOrderBizService.query(request);
	}

	/**
	 * 导出门店打烊工单
	 */
	public void export(WorkOrderRequest taskListParam, HttpServletRequest request, HttpServletResponse response, ModelMap map){
		workOrderBizService.export(taskListParam,request,response,map);
	}

	public Boolean penalizeMoney(OrderPenalizeMoneyRequest request){
		return workOrderBizService.penalizeMoney(request);
	}

	public BatchUpdatePenalizeVO batchUpdatePenalizeMoney(BatchUpdatePenalizeParam request){
		return workOrderBizService.batchUpdatePenalizeMoney(request);
	}

	public HttpResponse<Boolean> handleAppeal(StoreHandleAppealRequest request){
		return workOrderBizService.handleAppeal(request);
	}

	public BasePageResponse<QueryStoreOperateRecordResponse> queryOperateRecordPage(PaginationRequest<WorkOrderRecordRequest> request){
		return workOrderBizService.queryOperateRecordPage(request);
	}


}
